API Documentation
Public Member Functions | List of all members
nkGraphics::Compositor Class Referenceabstract

A compositor, describing how to compose the rendering pipeline. More...

Inheritance diagram for nkGraphics::Compositor:
nkGraphics::Resource nkExport::Exportable

Public Member Functions

 Compositor ()
 
virtual ~Compositor ()
 
virtual CompositorNodeaddNode ()=0
 
virtual void deleteNode (unsigned int index)
 
virtual void changeNodeOrder (unsigned int fromIndex, unsigned int toIndex)
 
virtual void clearNodes ()
 
unsigned int getNodeCount () const
 
CompositorNodegetNode (unsigned int index) const
 
virtual bool load () override
 
virtual void unload () override
 
virtual void renderChain ()
 
virtual void exportClassToTree (nkExport::Node *rootNode) override
 
virtual void importClassFromTree (nkExport::Node *rootNode) override
 
- Public Member Functions inherited from nkGraphics::Resource
 Resource ()
 
 Resource (const char *path)
 
virtual ~Resource ()
 
bool isReadyForRendering () const
 
bool isUnloaded () const
 
RESOURCE_LOAD_STATE getLoadState () const
 
std::string_view getResourcePath () const
 
RESOURCE_TYPE getResourceTypeName () const
 
std::string_view getResourceName () const
 
bool getHidden () const
 
virtual void setResourcePath (const std::string_view &path)
 
void setResourceName (const std::string_view &name)
 
void setHidden (bool value)
 
- Public Member Functions inherited from nkExport::Exportable
 Exportable ()
 
virtual ~Exportable ()
 

Detailed Description

A compositor, describing how to compose the rendering pipeline.

This class is the basic system that allows the whole rendering to occur.

The purpose is to populate it with CompositorNode. The nodes can be activated and deactivated on the fly.
Those nodes are populated with TargetOperation, which describes the outputs for a rendering operation.
The operations are populated with any kind of Pass. The pass are executed sequentially to reach the rendering result wished.

This descriptive kind of API allows the engine to organize and schedule work to help maintaining an efficient rendering logic. There is currently no other way in nkGraphics to render.

Constructor & Destructor Documentation

◆ Compositor()

nkGraphics::Compositor::Compositor ( )

Constructor. In theory, should never be called by external code. See CompositorManager::createOrRetrieve().

◆ ~Compositor()

virtual nkGraphics::Compositor::~Compositor ( )
virtual

Destructor.

Member Function Documentation

◆ addNode()

virtual CompositorNode* nkGraphics::Compositor::addNode ( )
pure virtual

Adds a node to the compositor.

Returns
The newly created node. The compositor owns the memory returned, external code should never delete it. See deleteNode().

◆ deleteNode()

virtual void nkGraphics::Compositor::deleteNode ( unsigned int  index)
virtual

Erases and frees a node memory.

Parameters
indexThe index of the node to free.

◆ changeNodeOrder()

virtual void nkGraphics::Compositor::changeNodeOrder ( unsigned int  fromIndex,
unsigned int  toIndex 
)
virtual

Changes the order of the nodes. Currently, this can be used to reorder the rendering steps (nodes are executed sequentially).

Parameters
fromIndexThe index of the node to move.
toIndexThe index to which the node should be moved.

◆ clearNodes()

virtual void nkGraphics::Compositor::clearNodes ( )
virtual

Clears and frees all the nodes.

◆ getNodeCount()

unsigned int nkGraphics::Compositor::getNodeCount ( ) const
Returns
The number of nodes available.

◆ getNode()

CompositorNode* nkGraphics::Compositor::getNode ( unsigned int  index) const
Parameters
indexThe index of the node to retrieve.
Returns
The node requested if available, nullptr else.

◆ load()

virtual bool nkGraphics::Compositor::load ( )
overridevirtual

Loads the compositor. This function should be called when the compositor has been modified and should be ready for a new rendering. During this step, the compositor creates all resources it will need to be efficient in the rendering. This can mean parsing dependencies in the rendering, organizing them, and such.

Returns
If the loading went well (true) or not (false).

Implements nkGraphics::Resource.

◆ unload()

virtual void nkGraphics::Compositor::unload ( )
overridevirtual

Unloads the compositor and frees all resources created during its loading.

Implements nkGraphics::Resource.

◆ renderChain()

virtual void nkGraphics::Compositor::renderChain ( )
virtual

Renders the compositor. This triggers the rendering process for the whole compositor. This method is a good candidate to do off-screen rendering.

◆ exportClassToTree()

virtual void nkGraphics::Compositor::exportClassToTree ( nkExport::Node rootNode)
overridevirtual

Basic exporting capability.

Parameters
rootNodeThe tree to export to.

Implements nkExport::Exportable.

◆ importClassFromTree()

virtual void nkGraphics::Compositor::importClassFromTree ( nkExport::Node rootNode)
overridevirtual

Basic importing capability.

Parameters
rootNodeThe tree to import from.

Implements nkExport::Exportable.


The documentation for this class was generated from the following file: